package com.example.warehouse.contrallor;


import com.example.warehouse.entity.InStore;
import com.example.warehouse.entity.Result;
import com.example.warehouse.entity.Store;
import com.example.warehouse.page.Page1;
import com.example.warehouse.service.InstoreService;
import com.example.warehouse.service.StoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/instore")
public class contrallorInStore {

    @Autowired(required = false)
    private InstoreService instoreService;

    @Autowired
    private StoreService storeService;
    @RequestMapping("/store-list")
    public Result findAllStore(){
        List<Store> allStore = storeService.findAllStore();
        return Result.ok(allStore);
    }

    @RequestMapping("/instore-page-list")
    public Result QueryPage(InStore inStore, Page1 page1){
        page1= instoreService.QueryPage(inStore, page1);
        return Result.ok(page1);
    }

    @PutMapping("/instore-confirm")
    public Result confirmInstore(@RequestBody InStore inStore){
        instoreService.confirmInstore(inStore);
        return Result.ok("商品入库成功");
    }


}
